package com.tencent.mm.opensdk.modelmsg;

import android.os.Bundle;
import android.util.Log;

import com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject;

import java.io.File;

public class WXEmojiObject implements IMediaObject {
    private static final int CONTENT_LENGTH_LIMIT = 10485760;
    private static final String TAG = "MicroMsg.SDK.WXEmojiObject";
    public byte[] emojiData;
    public String emojiPath;

    public WXEmojiObject() {

        this.emojiData = null;
        this.emojiPath = null;
    }

    public WXEmojiObject(String arg1) {

        this.emojiPath = arg1;
    }

    public WXEmojiObject(byte[] arg1) {

        this.emojiData = arg1;
    }

    public boolean checkArgs() {
        int v2 = 10485760;
        boolean v0 = false;
        if (this.emojiData == null || this.emojiData.length == 0) {
            if (this.emojiPath != null && this.emojiPath.length() != 0) {
            } else {
                Log.e("MicroMsg.SDK.WXEmojiObject", "checkArgs fail, both arguments is null");
                return false;
            }
        } else {
        }
        if (this.emojiData != null && this.emojiData.length > v2) {
            Log.e("MicroMsg.SDK.WXEmojiObject", "checkArgs fail, emojiData is too large");
            return v0;
        }

        if (this.emojiPath != null && this.getFileSize(this.emojiPath) > v2) {
            Log.e("MicroMsg.SDK.WXEmojiObject", "checkArgs fail, emojiSize is too large");
            return v0;
        }

        return true;
    }

    private int getFileSize(String arg4) {
        int v0 = 0;
        if (arg4 != null && arg4.length() != 0) {
            File v1 = new File(arg4);
            if (v1.exists()) {
                v0 = ((int) v1.length());
            }
        }

        return v0;
    }

    public void serialize(Bundle arg3) {
        arg3.putByteArray("_wxemojiobject_emojiData", this.emojiData);
        arg3.putString("_wxemojiobject_emojiPath", this.emojiPath);
    }

    public void setEmojiData(byte[] arg1) {
        this.emojiData = arg1;
    }

    public void setEmojiPath(String arg1) {
        this.emojiPath = arg1;
    }

    public int type() {
        return 8;
    }

    public void unserialize(Bundle arg2) {
        this.emojiData = arg2.getByteArray("_wxemojiobject_emojiData");
        this.emojiPath = arg2.getString("_wxemojiobject_emojiPath");
    }
}

